<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }

    div {
      position: absolute;
      top: 100px;
      left: 100px;
      width: 400px;
      height: 300px;
      background-color: #cccccc;
    }

    div p {

    }
  </style>
  <script src="../../Resource/外部库/jquery-3.2.1.min.js"></script>
  <script>
    $(function () {
//      offset坐标值
      $("#btn1").click(function () {
        console.log($("div").offset().top);
        console.log($("div").offset().left);

      });
//      相对于父元素的位置
      $("").click(function () {
        console.log($("p").position().top);
        console.log($("p").position().left);
      })

    });
  </script>
</head>
<body>
<button id="btn1">获取offset坐标值</button>
<div>
  <p>我是子元素</p>
</div>
</body>
</html>